#include <QApplication>
#include <QQmlApplicationEngine>

//#include "QQuickViews/QQuickOffscreenWebView.h"
//#include "QQuickViews/QQuickOffscreenEditText.h"
#include "utils/webviewutils.h"
#include "utils/utils.h"
#include "databasecreator.h"
#include "synccontroller.h"
#include "fornecedorescontroller.h"
#include "produtoscontroller.h"
#include "coletascontroller.h"
#include "embalagenscontroller.h"
#include "entity/trcoletaitem.h"
#include <QtQml>
#include <QQmlEngine>
#include "eventfilter.h"

#ifdef Q_OS_IOS
#include "ioswebview.h"
#endif

int main(int argc, char *argv[])
{
//    QAndroidQPAPluginGap::preloadJavaClasses();
//    QAndroidOffscreenWebView::preloadJavaClasses();
//    QAndroidOffscreenEditText::preloadJavaClasses();

    QApplication app(argc, argv);

//    qmlRegisterType<QQuickAndroidOffscreenEditText>("SceneGraphRendering", 1, 0, "OffscreenEditText");
//    qmlRegisterType<QQuickAndroidOffscreenWebView>("SceneGraphRendering", 1, 0, "OffscreenWebView");
    qmlRegisterType<EventFilter>("Utils", 1, 0, "EventFilter");
    qmlRegisterType<WebviewUtils>("Utils", 1, 0, "WebviewUtils");  
    qmlRegisterType<Utils>("Utils", 1, 0, "Utils");
    qmlRegisterType<SyncController>("Utils", 1, 0, "SyncController");
    qmlRegisterType<FornecedoresController>("Utils", 1, 0, "FornecedoresController");
    qmlRegisterType<ProdutosController>("Utils", 1, 0, "ProdutosController");
    qmlRegisterType<ColetasController>("Utils", 1, 0, "ColetasController");
    qmlRegisterType<EmbalagensController>("Utils", 1, 0, "EmbalagensController");
    qmlRegisterType<TRCOLETAITEM>("Utils", 1, 0, "TRCOLETAITEM");

#ifdef Q_OS_IOS
    qmlRegisterType<IOSWebView>("Utils", 1, 0, "IOSWebView");
#endif

    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/qml/MainLoader.qml")));


//    SyncController sync;
//    sync.startLoad();

    return app.exec();
}
